const fs = require("fs");
const path = require("path");
const datas = fs.readFileSync(path.resolve(process.cwd(), "static/datas.txt"), {
  encoding: "utf-8",
});
console.log("datas", datas);

const result = datas.match(/(编号(?:(?!编号).|\n)+)/gs);
console.log("result", result);
const result1 = result.map((item) => {
  let sex = item.match(/性别\s*[:：]\s*([男女])/)?.[1];
  if (!sex) {
    sex = item.match(/[男女]/)?.[0];
  }

  if (sex) {
    return {
      content: item,
      sex,
    };
  } else {
    return null;
  }
});
console.log("result1", result1);
